public class leetcode215 {
    public static void main(String[] args) {
        String s = "";
        int len = lengthOfLongestSubstring(s);
        System.out.println(len);
    }
    static int lengthOfLongestSubstring(String s) {
        if(s.length()==0) return 0;
        char[] ss = s.toCharArray();
        int right =0, left=0, max=0;
        for(;right<ss.length;right++){
            for(int i=left;i<right;i++){
                if(ss[right]==ss[i]){
                    max = Math.max(max, (right - left));
                    left=i+1;
                }
            }

        }
        return Math.max(max,right-left);
    }
}
